﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

using CSF.Security.Service;
using CSF.Security.Data;
using CSF.Security.BLL;

namespace CSF.Service.Accounts
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“PermissionSvc”。
    public class PermissionSvc : IPermissionSvc
    {

        #region IDataEntityService<Permission> 成员

        public List<Permission> GetAll()
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetAll();
        }

        public int Insert(Permission entity)
        {
            PermissionBLL bll = new PermissionBLL();
             bll.Insert(entity);
             return entity.Id;
        }

        #endregion

        #region IDataConfigService<Permission> 成员

        public Permission GetOneByCode(string code)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetOneByCode(code);
        }

        public List<Permission> GetEnable()
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetEnable();
        }

        public List<Permission> GetDisable()
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetDisable();
        }

        public List<Permission> GetStartsWith(string keyword, bool isDisable)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetStartsWith(keyword, isDisable);
        }

        public bool Enable(Permission t)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.Enable(t);
        }

        public bool Disable(Permission t)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.Disable(t);
        }

        #endregion

        #region IDataIdKeyService<Permission> 成员

        public Permission GetOneById(int id)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.GetOneById(id);
        }

        public bool UpdateById(Permission t, int id)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.UpdateById(t, id);
        }

        public bool DeleteOneById(int id)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.DeleteOneById(id);
        }

        #endregion

        #region IDataIdKeyService<Permission> 成员


        public int DeleteById(IEnumerable<int> ids)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.DeleteById(ids);
        }

        #endregion

        #region IDataIdKeyConfigService<Permission> 成员

        public int SetDisable(IEnumerable<int> ids, bool isDisable, string modifyBy)
        {
            PermissionBLL bll = new PermissionBLL();
            return bll.SetDisable(ids, isDisable, modifyBy);
        }

        #endregion
    }
}
